
/*
* Copyright 2017-2018 pinganfang
* All right reserved.
*
*/
package com.pingan.haofang.searchcloud.indexdatasource.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import com.pingan.haofang.searchcloud.common.domain.BaseDomain;
import com.pingan.haofang.searchcloud.index.constants.IndexDataSourceType;

/**
 * 索引全量增量构建信息
 *
 * @author huhailiang937
 */
@Entity
@Table(name = "t_index_datasource")
@EntityListeners({AuditingEntityListener.class})
public class IndexDatasource extends BaseDomain {

    /**
     * ID
     */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id")
    private Long id;

    /**
     * 数据源
     */
    @Column(name = "name")
    private String name;

    /**
     * 索引ID
     */
    @Column(name = "index_id")
    private Long indexId;

    /**
     * 全量服务类型:0-JSON_RPC，2-数据库SQL
     *
     * @see IndexDataSourceType
     */
    @Column(name = "full_datasource_type")
    private Integer fullDatasourceType;

    /**
     * 全量服务ID
     */
    @Column(name = "full_datasource_id")
    private Long fullDatasourceId;

    /**
     * 增量服务类型, -1-无需增量， 0-JSON_RPC，1-消息队列
     *
     * @see IndexDataSourceType
     */
    @Column(name = "inc_datasource_type")
    private Integer incDatasourceType;

    /**
     * 增量服务ID
     */
    @Column(name = "inc_datasource_id")
    private Long incDatasourceId;

    /**
     * 状态 0：正常 1：停用
     */
    @Column(name = "status")
    private Integer status;


    /**
     * ID
     *
     * @param id the value for id
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * ID
     *
     * @return id the value for id
     */
    public Long getId() {
        return this.id;
    }

    /**
     * 索引ID
     *
     * @param indexId the value for index_id
     */
    public void setIndexId(Long indexId) {
        this.indexId = indexId;
    }

    /**
     * 索引ID
     *
     * @return indexId the value for index_id
     */
    public Long getIndexId() {
        return this.indexId;
    }

    /**
     * 全量服务类型 0：Reful 1：MQ 2:SQL
     *
     * @param fullDatasourceType the value for full_import_type
     */
    public void setFullDatasourceType(Integer fullDatasourceType) {
        this.fullDatasourceType = fullDatasourceType;
    }

    /**
     * 全量服务类型 0：Reful 1：MQ 2:SQL
     *
     * @return fullDatasourceType the value for full_import_type
     */
    public Integer getFullDatasourceType() {
        return this.fullDatasourceType;
    }

    /**
     * 全量服务ID
     *
     * @param fullDatasourceId the value for full_import_id
     */
    public void setFullDatasourceId(Long fullDatasourceId) {
        this.fullDatasourceId = fullDatasourceId;
    }

    /**
     * 全量服务ID
     *
     * @return fullDatasourceId the value for full_import_id
     */
    public Long getFullDatasourceId() {
        return this.fullDatasourceId;
    }

    /**
     * 增量服务类型 0：Reful 1：MQ
     *
     * @param incDatasourceType the value for inc_import_type
     */
    public void setIncDatasourceType(Integer incDatasourceType) {
        this.incDatasourceType = incDatasourceType;
    }

    /**
     * 增量服务类型 0：Reful 1：MQ
     *
     * @return incDatasourceType the value for inc_import_type
     */
    public Integer getIncDatasourceType() {
        return this.incDatasourceType;
    }

    /**
     * 增量服务ID
     *
     * @param incDatasourceId the value for inc_import_id
     */
    public void setIncDatasourceId(Long incDatasourceId) {
        this.incDatasourceId = incDatasourceId;
    }

    /**
     * 增量服务ID
     *
     * @return incDatasourceId the value for inc_import_id
     */
    public Long getIncDatasourceId() {
        return this.incDatasourceId;
    }

    /**
     * 状态 0：正常 1：停用
     *
     * @param status the value for status
     */
    public void setStatus(Integer status) {
        this.status = status;
    }

    /**
     * 状态 0：正常 1：停用
     *
     * @return status the value for status
     */
    public Integer getStatus() {
        return this.status;
    }

    public String toString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }
}
